package com.web.dao;

import com.web.entity.ChargeManageInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ChargeManageInfoMapper {
    @Delete({
        "delete from APP_CHARGE_MANAGE",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into APP_CHARGE_MANAGE (account, send, ",
        "create_by, modify_by, ",
        "create_time, modify_time)",
        "values (#{account,jdbcType=DOUBLE}, #{send,jdbcType=DOUBLE}, ",
        "#{createBy,jdbcType=VARCHAR}, #{modifyBy,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(ChargeManageInfo record);

    int insertSelective(ChargeManageInfo record);

    @Select({
        "select",
        "id, account, send, create_by, modify_by, create_time, modify_time",
        "from APP_CHARGE_MANAGE",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ChargeManageInfo selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(ChargeManageInfo record);

    @Update({
        "update APP_CHARGE_MANAGE",
        "set account = #{account,jdbcType=DOUBLE},",
          "send = #{send,jdbcType=DOUBLE},",
          "create_by = #{createBy,jdbcType=VARCHAR},",
          "modify_by = #{modifyBy,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "modify_time = #{modifyTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ChargeManageInfo record);

    List<ChargeManageInfo> allInfo();

    ChargeManageInfo selectById(@Param("key") String key,@Param("value") String value);
}